class Solution
{
public:
    vector<vector<string>> groupAnagrams(vector<string>& strs)
    {
        unordered_map<string, vector<string>> hahs;
        for (auto& s : strs)
        {
            string tmp = s;
            sort(tmp.begin(), tmp.end());
            hahs[tmp].push_back(s);
        }
        vector<vector<string>> ret;
        for (auto [a, b] : hahs)
        {
            ret.push_back(b);
        }
        return ret;
    }
};